import request from '@/service/request'

/**
 * 用户接口
 */
// 获取用户列表
const getUserList = (params) => {
  return request.post('/sys/user/userPage', params)
}

// 添加用户
const addUser = (params) => {
  return request.post('/sys/user/addUser', params)
}

// 根据id获取用户信息
const getUserInfoById = (params) => {
  return request.get('/sys/user/getById/' + params)
}

// 根据id删除用户
const deleteUserById = (params) => {
  return request.get('/sys/user/del/' + params)
}

// 根据id获取角色列表
const getRoleListById = (params) => {
  return request.get('/sys/user/roleId/getByUserId/' + params)
}

// 分配用户角色
const setUserRole = (params) => {
  return request.post('/sys/user/setUserRole', params)
}

/**
 * 角色接口
 */
// 获取角色列表
const getRoleList = (params) => {
  return request.post('/sys/role/rolePage', params)
}

// 添加角色
const addRole = (params) => {
  return request.post('/sys/role/addRole', params)
}

// 根据id获取角色信息
const getRoleInfoById = (params) => {
  return request.get('/sys/role/getById/:id' + params)
}

// 根据id删除角色
const deleteRoleById = (params) => {
  return request.get('/sys/role/del/' + params)
}

// 根据id获取角色菜单
const getRoleMenuById = (params) => {
  return request.get('/sys/role/menuId/getByRoleId/' + params)
}

// 分配角色菜单
const setRoleMenu = (params) => {
  return request.post('/sys/role/setRoleMenu', params)
}

/**
 * 菜单接口
 */
// 获取菜单列表
const getMenuList = (params) => {
  return request.get('/sys/menu/getMenuTree', params)
}

// 添加菜单
const addMenu = (params) => {
  return request.post('/sys/menu/addMenu', params)
}

// 根据id获取菜单信息
const getMenuInfoById = (params) => {
  return request.get('/sys/menu/getById/' + params)
}

// 根据id删除菜单
const deleteMenuById = (params) => {
  return request.get('/sys/menu/del/' + params)
}

export {
  getUserList,
  addUser,
  getUserInfoById,
  deleteUserById,
  setUserRole,
  getRoleList,
  getRoleListById,
  addRole,
  getRoleInfoById,
  deleteRoleById,
  getRoleMenuById,
  setRoleMenu,
  getMenuList,
  addMenu,
  getMenuInfoById,
  deleteMenuById
}
